#ifndef COLOR_H_
#define COLOR_H_

#include "Vec3.h"
class File;

//really crap color class, needs work
class Color
{
public:
    /* Default Ctr */
    Color() : 
    m_r(0.0f),
    m_g(0.0f),
    m_b(0.0f),
    m_a(1.0f) {}
    Color(float r, float g, float b, float a = 1.0f): 
    m_r(r),
    m_g(g),
    m_b(b),
    m_a(a) {}
    Color(const Vec3& col, float alph = 1.0f) :
    m_r(col.m_x),
    m_g(col.m_y),
    m_b(col.m_z),
    m_a(alph) {}

    /* Set functions */
    void SetAll(float r, float g, float b, float a = 1.0f);
    bool Load(File* f);

    void Apply(bool alpha = false);
    void Neutralise();

    Color& SetWhite();
    Color& SetBlack();

    Color operator*(const float o) const
    {
        return Color(m_r * o, m_g * o, m_b *o, m_a * o);
    }
    Color operator*=(const float o)
    {
        m_r *= o;
        m_g *= o;
        m_b *= o; 
        m_a *= o;
        return *this;
    }
    Color operator*(const Vec3& o) const
    {
        return Color(m_r * o.m_x, m_g * o.m_y, m_b * o.m_z, m_a * 1.0f);
    }
    Color operator+(const Color& o) const
    {
        return Color(m_r + o.m_r, m_g + o.m_g, m_b + o.m_b, m_a + o.m_a);
    }
    Color& operator+=(const Color& o)
    {
        m_r += o.m_r; 
        m_g += o.m_g; 
        m_b += o.m_b;
        m_a += o.m_a;
        return (*this);
    }

    Color operator*(const Color& o)const
    {
        return Color(m_r * o.m_r, m_g * o.m_g, m_b * o.m_b, m_a * o.m_a);
    }
    Color operator*=(const Color& o)
    {
        m_r *= o.m_r; m_g *= o.m_g; m_b *= o.m_b; m_a *= o.m_a;
        return *this;
    }
public:
    float m_r;
    float m_g;
    float m_b;
    float m_a;
};

#endif